diff options
| author | Rafi Zadanly <rafizadanly@gmail.com> | 2022-12-14 17:48:03 +0700 |
|---|---|---|
| committer | Rafi Zadanly <rafizadanly@gmail.com> | 2022-12-14 17:48:03 +0700 |
| commit | bd4008ac5c2a22c1d99239ba0691cfb8ef0e9aea (patch) | |
| tree | c2f1289cfaa68ba5154e695f26d80278f42208f1 /src/pages/shop/product/[slug].js | |
| parent | 4e2b85a16b032df07686fd044ba9183afceb8b11 (diff) | |
add to cart, cart page, change cart item quantity
Diffstat (limited to 'src/pages/shop/product/[slug].js')
| -rw-r--r-- | src/pages/shop/product/[slug].js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pages/shop/product/[slug].js b/src/pages/shop/product/[slug].js index e44cfeca..cabda175 100644 --- a/src/pages/shop/product/[slug].js +++ b/src/pages/shop/product/[slug].js @@ -9,7 +9,7 @@ import { LazyLoadImage } from "react-lazy-load-image-component"; import "react-lazy-load-image-component/src/effects/blur.css"; import ProductSlider from "../../../components/product/ProductSlider"; import Layout from "../../../components/Layout"; -import { addToCart } from "../../../helpers/cart"; +import { createOrUpdateItemCart } from "../../../helpers/cart"; export async function getServerSideProps( context ) { const { slug } = context.query; @@ -83,7 +83,7 @@ export default function ProductDetail({ product }) { let addItemToCart = () => { if (quantity > 0) { - addToCart(activeVariant.id, parseInt(quantity)); + createOrUpdateItemCart(activeVariant.id, parseInt(quantity)); } return true; } |
